import Vue from 'vue'
import Router from 'vue-router'

// import Home from '../components/homepage/Home'
// import List from '../components/user/List'
import Login from '../components/login/Login'
import MainTable from '../views/MainTable'
import Economic from '../components/news/Economic'
import Entertainment from '../components/news/Entertainment'
import International from "../components/news/International"
import Life from '../components/news/Life'
import Political from '../components/news/Political'
import Sports from '../components/news/Sports'
import Addition from '../components/Addition'
import ShowNews from '../components/ShowNews'
import AllNews from '../components/news/AllNews'
import Administrator from '../views/Administrator'
import Approval from '../components/admin/Approval'
import Check from '../components/admin/Check'
import PersonalSpace from '../views/PersonalSpace'
import Modify from '../components/personal/Modify'
import MyNews from '../components/personal/MyNews'
import Comments from '../components/personal/Comments'
import ShowMyNews from '../components/personal/ShowMyNews'

Vue.use(Router)

const VueRouterPush = Router.prototype.push
Router.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}
export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/mainTable',
    },
    {
      path:'/login',
      name:'Login',
      component:Login
    },
    {
      path: '/mainTable',
      name: 'MainTable',
      component: MainTable,
      children: [{
          path: '/economic',
          component: Economic
        },
        {
          path: '/entertainment',
          component: Entertainment
        },
        {
          path: '/international',
          component: International
        },
        {
          path: '/life',
          component: Life
        },
        {
          path: '/political',
          component: Political
        },
        {
          path: '/sports',
          component: Sports
        },
        {
          path: '/allNews',
          component: AllNews
        }
      ]
    },
    {
      path:'/addition',
      name:'Addition',
      component:Addition
    },
    {
      path:'/showNews',
      name:'ShowNews',
      component:ShowNews
    },
    {
      path:'/administrator',
      name:'Administrator',
      component:Administrator,
      children:[{
        path:'/approval',
        component:Approval
      },
      {
        path:'/check',
        component:Check
      },
    ]
    },
    {
      path:'/personalSpace',
      name:'PersonalSpace',
      component:PersonalSpace,
      children:[{
        path:'/modify',
        component:Modify
      },
      {
        path:'/myNews',
        component:MyNews
      },
      {
        path:'/comments',
        component:Comments
      },
    ]
    },

    {
      path:'/showMyNews',
      component:ShowMyNews
    },
    


  ]
})
